package player;

import game.GameUtil;

public abstract class Player {
    private int id;
    protected String name;

    @Deprecated
    public Player() {}

    public Player(String name) {
	id = GameUtil.getNextPlayerId();
	this.name = name;
    }

    public int getId() {
	return id;
    }
    public String getName() {
	return name;
    }
    public void setName(String name) {
	this.name = name;
    }

    @Override
    public boolean equals(Object obj) {
	if (obj == null) {
	    return false;
	}
	if (getClass() != obj.getClass()) {
	    return false;
	}
	final Player other = (Player) obj;
	if (this.id != other.id) {
	    return false;
	}
	return true;
    }

    @Override
    public int hashCode() {
	int hash = 5;
	hash = 29 * hash + this.id;
	return hash;
    }
}
